$uptime = (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
$logPath = "$env:USERPROFILE\Documents\UptimeLog.txt"
$entry = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Uptime: $($uptime.Days) days, $($uptime.Hours) hours"

Add-Content -Path $logPath -Value $entry
Write-Host "Uptime logged to $logPath"